import axios from "axios";

function upload(path,userForm){
    //带有文件，需要使用FormData进行包装
    const params = new FormData()
    for(let i in userForm){
        params.append(i,userForm[i])
    }
    //console.log(params)
    return axios.post(path,params,{
        headers:{
            //传输格式，带有文件时必须用此格式
            "Content-Type":"multipart/form-data"
        }
    }).then(res=>res.data)
}

export default upload